import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '特定岗位',
    align:"center",
    dataIndex: 'specificPositions',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '授权签字',
    align:"center",
    dataIndex: 'isAuthSign',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}])
     },
   },
   {
    title: '年龄',
    align:"center",
    dataIndex: 'age'
   },
   {
    title: '头像图片',
    align:"center",
    dataIndex: 'avatar',
    customRender:render.renderImage,
   },
   {
    title: '出生年月',
    align:"center",
    dataIndex: 'birthday'
   },
   {
    title: '证件类型',
    align:"center",
    dataIndex: 'documentType'
   },
   {
    title: '文化程度',
    align:"center",
    dataIndex: 'education_dictText'
   },
   {
    title: '邮箱',
    align:"center",
    dataIndex: 'email'
   },
   {
    title: '性别',
    align:"center",
    dataIndex: 'gender_dictText'
   },
   {
    title: '毕业院校',
    align:"center",
    dataIndex: 'graduateInstitutions'
   },
   {
    title: '证件号',
    align:"center",
    dataIndex: 'idNumber'
   },
   {
    title: '所学专业',
    align:"center",
    dataIndex: 'major_dictText'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name_dictText'
   },
   {
    title: '联系电话',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '职务/职称',
    align:"center",
    dataIndex: 'post'
   },
   {
    title: '签名手写图片',
    align:"center",
    dataIndex: 'signaturePic',
    customRender:render.renderImage,
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "姓名",
      field: 'name',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"sys_user,realname,username"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '特定岗位',
    field: 'specificPositions',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '授权签字',
    field: 'isAuthSign',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '年龄',
    field: 'age',
    component: 'Input',
  },
  {
    label: '头像图片',
    field: 'avatar',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 0
      },
  },
  {
    label: '出生年月',
    field: 'birthday',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '证件类型',
    field: 'documentType',
    component: 'Input',
  },
  {
    label: '文化程度',
    field: 'education',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:""
     },
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
  },
  {
    label: '性别',
    field: 'gender',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sex",
        type: "radio"
     },
  },
  {
    label: '毕业院校',
    field: 'graduateInstitutions',
    component: 'Input',
  },
  {
    label: '证件号',
    field: 'idNumber',
    component: 'Input',
  },
  {
    label: '所学专业',
    field: 'major',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"test,name,id"
     },
  },
  {
    label: '姓名',
    field: 'name',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sys_user,realname,username"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入姓名!'},
          ];
     },
  },
  {
    label: '联系电话',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '职务/职称',
    field: 'post',
    component: 'Input',
  },
  {
    label: '签名手写图片',
    field: 'signaturePic',
     component: 'JImageUpload',
     componentProps:{
        fileMax: 0
      },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  specificPositions: {title: '特定岗位',order: 0,view: 'switch', type: 'string',},
  isAuthSign: {title: '授权签字',order: 1,view: 'switch', type: 'string',},
  age: {title: '年龄',order: 2,view: 'text', type: 'string',},
  avatar: {title: '头像图片',order: 3,view: 'image', type: 'string',},
  birthday: {title: '出生年月',order: 4,view: 'datetime', type: 'string',},
  documentType: {title: '证件类型',order: 5,view: 'text', type: 'string',},
  education: {title: '文化程度',order: 6,view: 'list', type: 'string',dictCode: '',},
  email: {title: '邮箱',order: 7,view: 'text', type: 'string',},
  gender: {title: '性别',order: 8,view: 'radio', type: 'string',dictCode: 'sex',},
  graduateInstitutions: {title: '毕业院校',order: 9,view: 'text', type: 'string',},
  idNumber: {title: '证件号',order: 10,view: 'text', type: 'string',},
  major: {title: '所学专业',order: 11,view: 'list', type: 'string',dictTable: "test", dictCode: 'id', dictText: 'name',},
  name: {title: '姓名',order: 12,view: 'list', type: 'string',dictTable: "sys_user", dictCode: 'username', dictText: 'realname',},
  phone: {title: '联系电话',order: 13,view: 'text', type: 'string',},
  post: {title: '职务/职称',order: 14,view: 'text', type: 'string',},
  signaturePic: {title: '签名手写图片',order: 15,view: 'image', type: 'string',},
  remark: {title: '备注',order: 16,view: 'textarea', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}